package com.cx.service.impl;

import com.cx.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@org.springframework.stereotype.Service
public class Service {
    @Autowired
    RestTemplate restTemplate;
    public User test(String name, Integer age){
        User userInfo = new User();
        userInfo.setUserName(name);
        userInfo.setReward(age);
        System.out.println(restTemplate);
        return restTemplate.postForEntity("http://USER/server",userInfo, User.class).getBody();
    }
    public void sendRecentHtml(List<String> htmlPage){
        restTemplate.postForEntity("http://USER/recentHtml",htmlPage, String.class).getBody();
    }
}

//    public User helloConsumer(){
//        System.out.println(restTemplate);
////        User user = new User();
////        int i = 1 / 0;
//        // 调用HELLO-CLOUD-SERVICE服务提供的hello接口
////        return restTemplate.getForEntity("http://ASSET-USERCENTER-SERVICE/hello?name={1}", String.class,"ZhaoChenJun").getBody();
//        Map<String ,String > map = new HashMap<>();
//        map.put("name","CaoFengGe");
////        return restTemplate.getForEntity("http://ASSET-USERCENTER-SERVICE/hello?name={name}", String.class,map).getBody();
//        //把这个map传递过去，然后找到其中key值为name的value提交到服务中心
//        return restTemplate.getForEntity("http://ASSET-USERCENTER-SERVICE/hello", User.class).getBody();
//        //返回值是User
//
//    }